/* GUI CONVERTED from reoptr1e.p (converter v1.75) Sat Aug 12 23:07:34 2000 */
/* reoptr1e.p - LABOR OPERATION TRANSACTION BY PART (REPETITIVE)        */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                  */
/* All rights reserved worldwide.  This is an unpublished work.         */
/*V8:ConvertMode=Maintenance                                            */
/*K1Q4*/ /*V8:RunMode=Character,Windows                                 */
/* REVISION: 7.4      LAST MODIFIED: 06/16/95   BY: str *G0N9*          */
/* REVISION: 8.5      LAST MODIFIED: 12/12/95   BY: kxn *J034*          */
/* REVISION: 8.5      LAST MODIFIED: 05/01/96   BY: jym *G1MN*          */


/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane */
/* REVISION: 8.6E     LAST MODIFIED: 05/20/98   BY: *K1Q4* Alfred Tan   */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan   */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00 BY: *N08T* Annasaheb Rahane */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00 BY: *N0KP* myb              */
          {mfdeclre.i}
{gplabel.i} /* EXTERNAL LABEL INCLUDE */

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE reoptr1e_p_1 "Input Total"
/* MaxLen: Comment: */

&SCOPED-DEFINE reoptr1e_p_2 "Control Total"
/* MaxLen: Comment: */

&SCOPED-DEFINE reoptr1e_p_3 "Elapsed or Stop Time"
/* MaxLen: Comment: */

&SCOPED-DEFINE reoptr1e_p_4 "Start Time"
/* MaxLen: Comment: */

/* ********** End Translatable Strings Definitions ********* */

/*G1MN*/ {gpglefv.i}

          define shared variable start_setup as character label {&reoptr1e_p_4}
             format "99:99:XX".
          define shared variable start_run like start_setup.
          define shared variable stop_setup like start_setup
             label {&reoptr1e_p_3}.
          define shared variable stop_run like stop_setup.
          define shared variable last_date like op_date.
          define shared variable input_total as decimal format "->>9.9<<"
             label {&reoptr1e_p_1}.
          define shared variable control_total like input_total
             label {&reoptr1e_p_2}.
          define shared variable old_emp like op_emp.
           define shared variable shift like op_shift.
          define shared variable site like rps_site no-undo.
          define shared variable ranok as logical no-undo.
          define shared variable emp_recno as recid no-undo.

          define shared frame a.

/*G1MN*          {gpglefdf.i} */
          {reopf10a.i} /* Frame a definition */

          do with frame a:
             prompt-for op_emp with frame a editing:

                /* FIND NEXT/PREVIOUS RECORD */
                {mfnp.i emp_mstr op_emp emp_addr op_emp emp_addr emp_addr}

                if recno <> ? then do:
                   display emp_addr @ op_emp
                      emp_fname + " " + emp_lname @ ad_name.
                end.
             end.

             find emp_mstr where emp_addr = input op_emp no-lock no-error.
             if not available emp_mstr then do:
                {mfmsg.i 520 3} /* "Employee number does not exist.". */
                undo, retry.
             end.

             if lookup(emp_status,"AC,PT") = 0 then do:
                {mfmsg.i 4027 3} /* "Employee not on active status" */
                undo,retry.
             end.

             display emp_addr @ op_emp emp_fname + " " + emp_lname @ ad_name.

             if old_emp <> ? and old_emp <> input op_emp then do:
                assign
                control_total = 0
                input_total = 0
                start_run = "000000"
                stop_run = "000000".
             end.

             display last_date shift control_total input_total.

             set1: do on error undo, retry:
/*GUI*/ if global-beam-me-up then undo, leave.

                /*  IF THIS IS A BATCH RUN AND WE ARE DOING A RETRY, UNDO  */
                /*  AND LEAVE MAINLOOP (gpglef.i ERROR WAS INEFFECTIVE)    */
                if batchrun and retry then do:
                   return.
                end.
                set last_date shift site control_total editing:

                   if frame-field = "site" then do:
                      /* FIND/NEXT PREVIOUS*/
                      {mfnp.i si_mstr site si_site site si_site si_site}
                      if recno <> ? then do:
                         display si_site @ site.
                      end.
                   end.
                   else do:
                      readkey.
                      apply lastkey.
                   end.
                end. /* editing */

                find si_mstr no-lock where si_site = site no-error.
                if not available si_mstr then do:
                   {mfmsg.i 708 3} /* site does not exist */
                   next-prompt site.
                   undo, retry.
                end.

/*J034*/          {gprun.i ""gpsiver.p""
                   "(input site, input recid(si_mstr), output return_int)"}
/*GUI*/ if global-beam-me-up then undo, leave.

/*J034*/          if return_int = 0 then do:
/*J034*/             {mfmsg.i 725 3} /* USER DOES NOT HAVE ACCESS TO SITE */
/*J034*/             next-prompt site.
/*J034*/             undo, retry.
/*J034*/          end.

                /* Check effective date*/
/*G1MN*                {gpglef.i ""IC"" glentity last_date} */
/*G1MN*/          {gpglef1.i
                     &module = ""IC""
                     &entity = si_entity
                     &date = last_date
                     &prompt = "last_date"
                     &frame = "a"
                     &loop = "set1"
                     }

             end.
/*GUI*/ if global-beam-me-up then undo, leave.
 /* set statement */

             if last_date entered then input_total = 0.
             display input_total with frame a.

             emp_recno = recid(emp_mstr).
             ranok = yes.

          end.
